#makefile for v3d_interface

#v3d_build DIRs
v3dbuild_DIR		= ../../v3d_build
v3dbuild_INCDIR 	= $(v3dbuild_DIR)/inc
v3dbuild_LIBDIR 	= $(v3dbuild_DIR)/lib

#v3d_common DIRs
v3dcommon_DIR		= ../../v3d_common
v3dcommon_INCDIR 	= $(v3dcommon_DIR)/inc
v3dcommon_LIBDIR 	= $(v3dcommon_DIR)/lib

# source files.
SRCDIR = ../src
OBJDIR = ./obj
INCDIR = ../inc

FILES =  	v3d_renderer.cpp \
			gl_renderer.cpp

#OBJ = $(FILES:.cpp=.o)
OBJ_FILES = $(FILES:.cpp=.o)
OBJ =  $(patsubst %,$(OBJDIR)/%,$(OBJ_FILES))

SRC =  $(patsubst %,$(SRCDIR)/%,$(FILES))

OUT = ../lib/libv3d_renderer.a

# include directories
INCLUDES = -I. -I$(v3dcommon_INCDIR)/ -I$(INCDIR) 

# C++ compiler flags (-g -O2 -Wall)
CCFLAGS = -g

# compiler
CCC = g++

# library paths
LIBS = -L../lib -lgl

# compile flags
LDFLAGS = -g

.SUFFIXES: .cpp

build: dep $(OUT)

$(OBJDIR)/%.o : $(SRCDIR)/%.cpp
	$(CCC) $(INCLUDES) $(CCFLAGS) -c $< -o $@

$(OUT): $(OBJ)
	ar rcs $(OUT) $(OBJ)
	cp $(OUT) $(v3dbuild_LIBDIR)/
	cp $(INCDIR)/v3d_*.h $(v3dbuild_INCDIR)/

depend: dep

dep:
	#makedepend -- $(CFLAGS) -- $(INCLUDES) $(SRC)

clean:
	rm -f $(OBJ) $(OUT) Makefile.bak 
	
rebuild:
	@echo "..........v3d_interface rebuild started............. "
	$(MAKE) clean
	$(MAKE) build
	@echo "..........v3d_interface rebuild ended.......... "
	


